package com.module.login.utils

import android.content.Context
import android.content.Intent
import android.widget.Toast
import com.module.app.ext.notNull
import com.module.login.view.LoginCodeActivity
import com.module.login.view.LoginPhoneActivity

const val EXTRA_PHONE = "phone"

fun Context?.startLoginPhone() {
    notNull({
        it.startActivity(Intent(it, LoginPhoneActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startLoginCode(phone: String) {
    notNull({
        var intent = Intent(it, LoginCodeActivity::class.java)
        intent.putExtra(EXTRA_PHONE, phone)
        it.startActivity(intent)
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}